home *** CD-ROM | disk | FTP | other *** search
/ PC Direct 1998 August / PC Direct August 1998.iso / S / powerj / Product / hpp.z / WCOLRDLG.HPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-11-25  |  4.6 KB  |  147 lines

  1. /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2.    %     Copyright (C) 1994, by WATCOM International Inc.  All rights    %
  3.    %     reserved.  No part of this software may be reproduced or        %
  4.    %     used in any form or by any means - graphic, electronic or       %
  5.    %     mechanical, including photocopying, recording, taping or        %
  6.    %     information storage and retrieval systems - except with the     %
  7.    %     written permission of WATCOM International Inc.                 %
  8.    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  9. */
  10.  
  11. #ifndef _WCOLRDLG_HPP_INCLUDED
  12. #define _WCOLRDLG_HPP_INCLUDED
  13. #pragma once
  14.  
  15. #ifndef _WNO_PRAGMA_PUSH
  16. #pragma pack(push,8);
  17. #pragma enum int;
  18. #endif
  19.  
  20. #ifndef _WCOLOR_HPP_INCLUDED
  21. #  include "wcolor.hpp"
  22. #endif
  23. #ifndef _WCOMDLG_HPP_INCLUDED
  24. #  include "wcomdlg.hpp"
  25. #endif
  26. #ifndef _WARRAY_HPP_INCLUDED
  27. #  include "warray.hpp"
  28. #endif
  29.  
  30. typedef WArray< WColor >        WColorArray;
  31.  
  32. //
  33. // ColorDialog styles
  34. //
  35.  
  36. typedef WULong WCDStyle;
  37.  
  38. #define WCDSRGBInit               ((WCDStyle)0x00000001L) // CC_RGBINIT
  39. #define WCDSFullOpen              ((WCDStyle)0x00000002L) // CC_FULLOPEN
  40. #define WCDSPreventFullOpen       ((WCDStyle)0x00000004L) // CC_PREVENTFULLOPEN
  41. #define WCDSShowHelp              ((WCDStyle)0x00000008L) // CC_SHOWHELP
  42. #define WCDSEnableHook            ((WCDStyle)0x00000010L) // CC_ENABLEHOOK
  43. #define WCDSEnableTemplate        ((WCDStyle)0x00000020L) // CC_ENABLETEMPLATE
  44. #define WCDSEnableTemplateHandle  ((WCDStyle)0x00000040L) // CC_ENABLETEMPLATEHANDLE
  45. #define WCDSSolidColor            ((WCDStyle)0x00000080L) // CC_SOLIDCOLOR
  46. #define WCDSAnyColor              ((WCDStyle)0x00000100L) // CC_ANYCOLOR
  47.  
  48. // WColorDialog
  49. //
  50. //    Used to display color dialog.
  51.  
  52. class WCMCLASS WColorDialog : public WCommonDialog {
  53.     WDeclareSubclass( WColorDialog, WCommonDialog );
  54.  
  55.     public:
  56.  
  57.         /*******************************************************
  58.          * Constructors and Destructors
  59.          *******************************************************/
  60.  
  61.         WColorDialog();
  62.  
  63.         ~WColorDialog();
  64.  
  65.         /*******************************************************
  66.          * Properties
  67.          *******************************************************/
  68.  
  69.         // Color
  70.  
  71.         WColor GetColor() const;
  72.         WBool SetColor( const WColor & color );
  73.  
  74.         // CustomColorList
  75.         //
  76.         //    Set the list of colors to use in the custom color
  77.         //    section of the dialog.  The list of colors is an
  78.         //    array of 16 WColor objects.  The colors will be
  79.         //    modified as necessary and so must be read-write.
  80.  
  81.         #define WCD_NUM_COLORS 16
  82.  
  83.         WColorArray GetCustomColorList() const;
  84.         WBool SetCustomColorList( const WColorArray & list );
  85.  
  86.         // Style
  87.         //
  88.         //    Set the styles used by the file dialog.  Note that
  89.         //    the WCDSEnableHook style will ALWAYS be enabled.
  90.  
  91.         WCDStyle GetStyle() const;
  92.         WBool SetStyle( WCDStyle style );
  93.  
  94.         /*******************************************************
  95.          * Methods
  96.          *******************************************************/
  97.  
  98.         // ChangeStyle
  99.         //
  100.         //    Use to turn a specific style on or off.
  101.  
  102.         WBool ChangeStyle( WCDStyle style, WBool on );
  103.  
  104.         // Prompt
  105.         //
  106.         //    Display the dialog and wait for it to be dismissed.
  107.         //    The first form uses the current settings.  The second
  108.         //    is a convenience function.
  109.  
  110.         WBool Prompt();
  111.  
  112.         WBool Prompt( WWindow * owner, const WChar * title );
  113.  
  114.         /************************************************************
  115.          * Notifications
  116.          ************************************************************/
  117.  
  118.         void OnDialogInitialize( WWindowHandle hWnd, WWindowHandle focus );
  119.  
  120.         /************************************************************
  121.          * Others
  122.          ************************************************************/
  123.  
  124.     protected:
  125.  
  126.         virtual void  *PackCC();
  127.         virtual WBool  UnpackCC( WBool ok );
  128.  
  129.         /************************************************************
  130.          * Data members
  131.          ************************************************************/
  132.  
  133.     protected:
  134.  
  135.         void *          _cc;
  136.         WULong          _customColors[ 16 ];
  137.         WColorArray     _colorList;
  138.         WColor          _color;
  139. };
  140.  
  141. #ifndef _WNO_PRAGMA_PUSH
  142. #pragma enum pop;
  143. #pragma pack(pop);
  144. #endif
  145.  
  146. #endif // _WCOLRDLG_HPP_INCLUDED
  147.